<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>将元素属性的值作为 html 解析并显示</title>
</head>
<body>

<div id="change" class="change">
    <div html="html" style="background-color: red">Hello, World!</div>
    <div html="html" style="background-color: green">Hello, World!</div>
</div>

<script>
    let html = "<h1>Hello, Vue!</h1>";
    let elements = document.querySelectorAll("#change > div");
    for (let i = 0; i < elements.length; i++) {
        let attribute = elements[i].getAttribute("html");
        elements[i].innerHTML = eval(attribute);
    }
</script>
</body>
</html>